<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link href="/lib/layui/css/layui.css" rel="stylesheet"/>
    <link href="/css/common.css" rel="stylesheet"/>
    <link href="/lib/dtree/dtree.css" rel="stylesheet">
    <link href="/lib/dtree/font/dtreefont.css" rel="stylesheet">
    <title>编辑角色信息</title>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space10">
        <div class="layui-card">
            <div class="layui-card-body">
                <form class="layui-form">
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="layui-color-red">*</span>&nbsp;角色名称：</label>
                        <div class="layui-input-block">
                            <input class="layui-input" type="text" name="roleName" lay-verify="required" placeholder="请输入角色名称" autocomplete="off"
                                   maxlength="100">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="layui-color-red">*</span>&nbsp;权限字符：</label>
                        <div class="layui-input-block">
                            <input class="layui-input" type="text" name="permission" lay-verify="required" placeholder="请输入权限字符" autocomplete="off"
                                   maxlength="100">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="layui-color-red">*</span>&nbsp;排序：</label>
                        <div class="layui-input-block">
                            <input class="layui-input" type="text" name="orderNum" lay-verify="required|number" placeholder="请输入排序" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">角色菜单：</label>
                        <div class="layui-input-block">
                            <div style="height: 300px;border: 1px solid #e6e6e6;overflow: auto;">
                                <ul id="dTreeList" class="dtree" data-id="0"></ul>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="hidden" name="id">
                            <input type="hidden" name="menuId">
                            <button class="layui-btn" lay-filter="submitBtn" lay-submit data-url="/system/role/saveOrUpdate.do">提交</button>
                            <button class="layui-btn layui-hide" type="button" id="submit">提交</button>
                            <button class="layui-btn layui-btn-primary" type="button" id="cancel">取消</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script src="/lib/layui/layui.all.js" charset="utf-8"></script>
<script src="/script/common.js" charset="utf-8"></script>
<script>
    var id = getRequestParams('id');

    layui.use(['baseUtil'], function () {
        var baseUtil = layui.baseUtil;

        if (isNotBlank(id)) {
            var url = '/system/role/findVoOne.do';
            var params = { id: id };
            var cols = [
                { type: 'input', name: 'id' },
                { type: 'input', name: 'roleName' },
                { type: 'input', name: 'permission' },
                { type: 'input', name: 'orderNum' }
            ];
            baseUtil.initFormData(url, params, cols);
        }
        baseUtil.initDTree('#dTreeList', '/system/rolemenu/getTreeList.do?roleId=' + id, true, 'menuId');
    });
</script>
</body>
</html>
